Add checks and fix issues