Fix NPEs in Lazarus GUI