Fix some problem with completion and add some improvments

Authored by sirgienko on Feb 8 2019, 8:28 PM.