Fix tests for packages completion. Improve package parsing