final fixes to magic number check