phpStorm autocomplete fix and small code fixes