attempting to fix some fairly ciritical bugs

mainly it dies on 504.