core: sort methods by source line number
core: fix missing parenthesis in conditions
core: fix constructor instruction replacement